package com.sujiewon.salesadmin.customer.dao;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;

@Repository
public class CustomerDaoImpl implements CustomerDao {

	@Resource(name="sqlMapClient")
	private SqlMapClient sqlMapClient;
	
	@Override
	public void updateSeqId() throws SQLException {
		this.sqlMapClient.update("customer.updateSeqId");
	}

	@Override
	public int getSeqId() throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject("customer.getSeqId");
	}

	@SuppressWarnings("unchecked")
	@Override
	public HashMap<String, Object> getCustInfoByCustId(HashMap<String, Object> param) throws SQLException {
		return (HashMap<String, Object>) this.sqlMapClient.queryForObject("customer.getCustInfo", param);
	}

	@Override
	public void nextSeqId() throws SQLException {
		this.sqlMapClient.update("customer.nextSeqId");
	}

	@Override
	public void registerBasicInfo(HashMap<String, Object> paramMap) throws SQLException {
		this.sqlMapClient.insert("customer.insertCustInfo", paramMap);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<HashMap<String, Object>> getCustInfoList(HashMap<String, Object> paramMap) throws SQLException {
		return this.sqlMapClient.queryForList("customer.getCustInfo", paramMap);
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<HashMap<String, Object>> getCustCtrtInfoList(HashMap<String, Object> paramMap) throws SQLException {
		return this.sqlMapClient.queryForList("customer.getCustCtrtInfo", paramMap);
	}

	@Override
	public void registerCustMgrInfo(HashMap<String, Object> paramMap) throws SQLException {
		this.sqlMapClient.insert("customer.insertCustMgrInfo", paramMap);
	}

	@Override
	public void registerProjectContractInfo(HashMap<String, Object> paramMap) throws SQLException {
		this.sqlMapClient.insert("customer.insertCustCtrtPrjInfo", paramMap);
	}

	@SuppressWarnings("unchecked")
	@Override
	public HashMap<String, Object> getCustMgrInfo(HashMap<String, Object> paramMap) throws SQLException {
		return (HashMap<String, Object>) this.sqlMapClient.queryForObject("customer.getCustMgrInfo", paramMap);
	}

	@Override
	public void registerSalesProcess(HashMap<String, Object> paramMap) throws SQLException {
		this.sqlMapClient.insert("customer.insertSalesMgr", paramMap);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<HashMap<String, Object>> searchSalesProcess(HashMap<String, Object> paramMap) throws SQLException {
		return this.sqlMapClient.queryForList("customer.searchSalesProcess", paramMap);
	}

	@SuppressWarnings("unchecked")
	@Override
	public HashMap<String, Object> getProjectContractInfo(HashMap<String, Object> paramMap) throws SQLException {
		return (HashMap<String, Object>) this.sqlMapClient.queryForObject("customer.getCustCtrtPrjInfo", paramMap);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<HashMap<String, Object>> getSalesInfoList(HashMap<String, Object> paramMap) throws SQLException {
		return this.sqlMapClient.queryForList("customer.getSalesInfo", paramMap);
	}

	@Override
	public void updateCustMgrInfo(HashMap<String, Object> paramMap) throws SQLException {
		this.sqlMapClient.insert("customer.updateCustMgr", paramMap);
	}

	@Override
	public void updateProjectContractInfo(HashMap<String, Object> paramMap)	throws SQLException {
		this.sqlMapClient.update("customer.updateCustCtrtPrjInfo", paramMap);
	}

	@Override
	public void updateSalesInfo(HashMap<String, Object> paramMap) throws SQLException {
		this.sqlMapClient.update("customer.updateSalesMgr", paramMap);
	}

	@Override
	public void updateBasicInfo(HashMap<String, Object> paramMap) throws SQLException {
		this.sqlMapClient.update("customer.updateCustInfo", paramMap);
	}

	@Override
	public int totalCountSalesProcess(HashMap<String, Object> paramMap) throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject("customer.totalCountSalesProcess", paramMap);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<HashMap<String, Object>> getCustAllInfoList(HashMap<String, Object> paramMap) throws SQLException {
		return this.sqlMapClient.queryForList("customer.getCustAllInfo", paramMap);
	}
	
	@Override
	public int totalCustAllCount(HashMap<String, Object> paramMap) throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject("customer.totalCustAllCount", paramMap);
	}

	@Override
	public void deleteSalesMgr(HashMap<String, Object> paramMap) throws SQLException {
		this.sqlMapClient.delete("customer.deleteSalesMgr", paramMap);
	}

	@Override
	public void deleteCustCtrtPrj(HashMap<String, Object> paramMap) throws SQLException {
		this.sqlMapClient.delete("customer.deleteCustCtrtPrj", paramMap);
	}

	@Override
	public void deleteCustMgr(HashMap<String, Object> paramMap) throws SQLException {
		this.sqlMapClient.delete("customer.deleteCustMgr", paramMap);
	}

	@Override
	public void deleteCustInfo(HashMap<String, Object> paramMap) throws SQLException {
		this.sqlMapClient.delete("customer.deleteCustInfo", paramMap);
	}

	@Override
	public void deleteMatnSvc(HashMap<String, Object> paramMap)	throws SQLException {
		this.sqlMapClient.delete("customer.deleteMatnSvc", paramMap);
	}

	@Override
	public void deleteMatnMgr(HashMap<String, Object> paramMap)	throws SQLException {
		this.sqlMapClient.delete("customer.deleteMatnMgr", paramMap);
	}

	@Override
	public void deleteCustCtrtMatn(HashMap<String, Object> paramMap) throws SQLException {
		this.sqlMapClient.delete("customer.deleteCustCtrtMatn", paramMap);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<HashMap<String, Object>> getProjectReportList(HashMap<String, Object> paramMap) throws SQLException {
		return this.sqlMapClient.queryForList("customer.getProjectReportList", paramMap);
	}

	@Override
	public int totalCountProjectReport(HashMap<String, Object> paramMap) throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject("customer.totalCountProjectReport", paramMap);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<HashMap<String, Object>> getProjectList(HashMap<String, Object> paramMap) throws SQLException {
		return this.sqlMapClient.queryForList("customer.getProjectList", paramMap);
	}

	@Override
	public int totalCountProjectList(HashMap<String, Object> paramMap) throws SQLException {
		return (Integer) this.sqlMapClient.queryForObject("customer.totalCountProjectList", paramMap);
	}

	@Override
	public String getLastCustId() throws SQLException {
		return (String) this.sqlMapClient.queryForObject("customer.getLastCustId");
	}

}
